package com.kll.carolinehmibiz.presentation.presenter

import android.content.Context
import com.kll.carolinehmibiz.OperationManager
import com.kll.carolinehmibiz.model.OperateListener
import com.kll.carolinehmibiz.presentation.BasePresenter
import com.kll.carolinehmibiz.presentation.listener.WellcomeProtocol

class WellcomePresenter(context: Context, mView: WellcomeProtocol.IView) : BasePresenter(context), WellcomeProtocol.IPresenter {
    private var mView: WellcomeProtocol.IView? = mView
    var getDeviceStatusIsBusying = false


    override fun getDeviceStatus() {
        if (getDeviceStatusIsBusying) return
        getDeviceStatusIsBusying = true
        OperationManager.getInstancce().getDeviceStatus(object : OperateListener {
            override fun onSuccess(state: Int, obj: Any?) {
                getDeviceStatusIsBusying = false
                mView?.getDeviceStatusSuccessed(obj as Int)
            }

            override fun onFail(code: Int, message: String) {
                getDeviceStatusIsBusying = false
                mView?.getDeviceStatusFailed(message)
            }

        })
    }




}